#include <bits/stdc++.h>

using namespace std;

struct doc
{
	int flag;	//0:file 1:dir
	long long size=0;
	long long dirSum=0,dirMax=0,childSum=0,childMax=0;
	string name;
	vector<doc*>arr;
	doc* father;
};

doc *root;
stringstream ss;
vector<string>path;

doc* find(doc* pos, string name){
	for (long long i = 0; i < pos->arr.size(); ++i)
	{
		doc *p=pos->arr[i];
		if(p->name == name){
			return p;
		}
	}
	return NULL;
}

void init()
{
	string name, s;
	path.clear();ss.clear();cin>>s;ss<<s;
	while(getline(ss,name,'/')){
		path.push_back(name);
	}
}

doc* creatdoc(doc* father, string name, int flag){
	doc *node=new doc();
	node->name=name;
	node->father = father;
	father->arr.push_back(node);
	node -> flag = flag;
	return node;
}

doc* islegalpath(long long size)	//will return the final file to be found
{
	string name;
	doc *pos=root;
	for (long long i = 1; i < path.size() - 1; ++i)
	{
		name=path[i];
		doc* findresult=find(pos,name);
		if((findresult!=NULL&&findresult->flag==0)
			||(pos->childMax!=0 && pos->childSum + size > pos -> childMax)
			)	//the doc is a file or the size of child is too large
		{
			return NULL;
		}
		else if(findresult == NULL){
			findresult=creatdoc(pos, name, 1);
		}
		pos = findresult;
	}

	name = path.back();
	doc *findresult = find(pos,name);
	if((pos->childMax!=0 && pos->childSum + size > pos -> childMax)
	||(pos->dirMax!=0&&pos->dirSum + size > pos -> dirMax)
	||(findresult!=NULL&&findresult -> flag ==1)){
		return NULL;
	}
	else if(findresult == NULL){
		findresult=creatdoc(pos, name, 0);
	}
	return findresult;
}

void changesize(doc* file, long long change){
	doc* p = file -> father;
	while(p!=NULL){
		p->childSum += change;
		p = p->father;
	}
	file->father->dirSum += change;
}

void do_command_C(){
	long long size;scanf("%lld", &size);	
	int flag=1;
	doc* file=islegalpath(size);
	if(file == NULL){
		printf("N\n");
	}else{
		printf("Y\n");
		long long change = size - file ->size;
		file->size = size;
		changesize(file,change);
	}
}

void do_command_R(){
	printf("Y\n");

	string name;
	doc *pos=root;
	for (long long i = 1; i < path.size(); ++i)
	{
		name=path[i];
		doc* findresult=find(pos,name);
		if(findresult == NULL){
			return;
		}
		pos = findresult;
	}
	if(pos->flag == 0)
	{
		long long change = pos -> size;
		changesize(pos, -1 * change);
		if(pos!=root)
		{
			pos -> father -> dirSum += change;
		}
	}
	else if( pos -> flag == 1)
	{
		long long change = pos -> childSum;
		changesize(pos , -1 * change);
	}
	pos->name = "_zzx#";
}

void do_command_Q(){
	long  long dirMax,childMax;scanf("%lld%lld", &dirMax,&childMax);
	// printf("this is Q\n");
}

void showpath()
{
	cout<<"path size ="<<path.size()<<endl;
	for (int i = 0; i < path.size(); ++i)
	{
		cout<<path[i]<<' ';
	}
	cout<<endl;
}

int main(int argc, char const *argv[])
{
	int long long n;scanf("%lld",&n);
	getchar();
	root=new doc();
	root->father = NULL;
	root->flag=1;
	for (long long i = 0; i < n; ++i)
	{
		// printf("i=%d\n", i);
		char command;
		scanf("%c",&command);			
		init();
		// showpath();
		switch(command){
			case 'C':
				do_command_C();
				break;
			case 'R':
				do_command_R();
				break;
			case 'Q':
				do_command_Q();
				break;
		}
		getchar();
	}
	return 0;
}